home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-22 | 11.3 KB | 636 lines | [TEXT/MPS ] |
- ;
- ; File: Drag.a
- ;
- ; Contains: Assembly Interface for Drag Manager
- ;
- ; Copyright: © 1993-1994 by Apple Computer, Inc., all rights reserved.
- ;
-
- IF &TYPE('__INCLUDINGDRAG__') = 'UNDEFINED' THEN
- __INCLUDINGDRAG__ SET 1
-
- IF &TYPE('__INCLUDINGFSEQU__') = 'UNDEFINED' THEN ; get definition of FSSpec
- INCLUDE 'FSEqu.a'
- ENDIF
-
-
-
- _DragDispatch OPWORD $ABED ; will move to Traps.a
-
-
- ; Gestalt Selector and Response Constants
-
- gestaltDragMgrAttr EQU 'drag' ; Drag Manager attributes
- gestaltDragMgrPresent EQU 0 ; Drag Manager is present
- gestaltDragMgrFloatingWind EQU 1 ; Drag Manager supports floating windows
- gestaltPPCDragLibPresent EQU 2 ; Drag Manager PPC DragLib is present
-
- gestaltTEAttr EQU 'teat' ; TextEdit attributes
- gestaltTEHasGetHiliteRgn EQU 0 ; TextEdit has TEGetHiliteRgn
-
-
- ; Flavor Flags
-
- flavorSenderOnly EQU $00000001 ; flavor is available to sender only
- flavorSenderTranslated EQU $00000002 ; flavor is translated by sender
- flavorNotSaved EQU $00000004 ; flavor should not be saved
- flavorSystemTranslated EQU $00000100 ; flavor is translated by system
-
-
- ; Drag Attributes
-
- dragHasLeftSenderWindow EQU $00000001 ; drag has left the source window since TrackDrag
- dragInsideSenderApplication EQU $00000002 ; drag is occurring within the source application
- dragInsideSenderWindow EQU $00000004 ; drag is occurring within the source window
-
-
- ; Special Flavor Types
-
- flavorTypeHFS EQU 'hfs ' ; flavor type for HFS data
- flavorTypePromiseHFS EQU 'phfs' ; flavor type for promised HFS data
- flavorTypeDirectory EQU 'diry' ; flavor type for AOCE directories
-
-
- ; Drag Tracking Handler Messages
-
- dragTrackingEnterHandler EQU 1 ; drag has entered handler
- dragTrackingEnterWindow EQU 2 ; drag has entered window
- dragTrackingInWindow EQU 3 ; drag is moving within window
- dragTrackingLeaveWindow EQU 4 ; drag has exited window
- dragTrackingLeaveHandler EQU 5 ; drag has exited handler
-
-
- ; Drag Drawing Procedure Messages
-
- dragRegionBegin EQU 1 ; initialize drawing
- dragRegionDraw EQU 2 ; draw drag feedback
- dragRegionHide EQU 3 ; hide drag feedback
- dragRegionIdle EQU 4 ; drag feedback idle time
- dragRegionEnd EQU 5 ; end of drawing
-
-
- ; Zoom Acceleration
-
- zoomNoAcceleration EQU 0 ; use linear interpolation
- zoomAccelerate EQU 1 ; ramp up step size
- zoomDecelerate EQU 2 ; ramp down step size
-
-
- ; Result Codes - (will move to Errors.a)
-
- badDragRefErr EQU -1850 ; unknown drag reference
- badDragItemErr EQU -1851 ; unknown drag item reference
- badDragFlavorErr EQU -1852 ; unknown flavor type
- duplicateFlavorErr EQU -1853 ; flavor type already exists
- cantGetFlavorErr EQU -1854 ; error while trying to get flavor data
- duplicateHandlerErr EQU -1855 ; handler already exists
- handlerNotFoundErr EQU -1856 ; handler not found
- dragNotAcceptedErr EQU -1857 ; drag was not accepted by receiver
-
-
- ; HFS Flavor
-
- HFSFlavor RECORD 0
- fileType ds.b 4 ; OSType ; file type
- fileCreator ds.b 4 ; OSType ; file creator
- fdFlags ds.w 1 ; INTEGER ; Finder flags
- fileSpec ds FSSpec ; file system specification
- size EQU *
- ENDR
-
-
- ; Promise HFS Flavor
-
- PromiseHFSFlavor RECORD 0
- fileType ds.b 4 ; OSType ; file type
- fileCreator ds.b 4 ; OSType ; file creator
- fdFlags ds.w 1 ; INTEGER ; Finder flags
- promisedFlavor ds.b 4 ; FlavorType ; promised flavor containing FSSpec
- size EQU *
- ENDR
-
-
- ; Drag Manager Routines
-
-
- ; Installing and Removing Drag Handlers
-
- ;
- ; FUNCTION InstallTrackingHandler (trackingHandler : DragTrackingHandler;
- ; theWindow : WindowPtr;
- ; handlerRefCon : UNIV Ptr) : OSErr;
- ;
-
- MACRO
- _InstallTrackingHandler
- moveq #$01,d0
- _DragDispatch
- ENDM
-
- ;
- ; FUNCTION InstallReceiveHandler (receiveHandler : DragReceiveHandler;
- ; theWindow : WindowPtr;
- ; handlerRefCon : UNIV Ptr) : OSErr;
- ;
-
- MACRO
- _InstallReceiveHandler
- moveq #$02,d0
- _DragDispatch
- ENDM
-
-
- ;
- ; FUNCTION RemoveTrackingHandler (trackingHandler : DragTrackingHandler;
- ; theWindow : WindowPtr) : OSErr;
- ;
-
- MACRO
- _RemoveTrackingHandler
- moveq #$03,d0
- _DragDispatch
- ENDM
-
-
- ;
- ; FUNCTION RemoveReceiveHandler (receiveHandler : DragReceiveHandler;
- ; theWindow : WindowPtr) : OSErr;
- ;
-
- MACRO
- _RemoveReceiveHandler
- moveq #$04,d0
- _DragDispatch
- ENDM
-
-
-
- ; Creating and Disposing Drag References
-
- ;
- ; FUNCTION NewDrag (VAR theDragRef : DragReference) : OSErr;
- ;
-
- MACRO
- _NewDrag
- moveq #$05,d0
- _DragDispatch
- ENDM
-
-
- ;
- ; FUNCTION DisposeDrag (theDragRef : DragReference) : OSErr;
- ;
-
- MACRO
- _DisposeDrag
- moveq #$06,d0
- _DragDispatch
- ENDM
-
-
-
- ; Adding Drag Item Flavors
-
- ;
- ; FUNCTION AddDragItemFlavor (theDragRef : DragReference;
- ; theItemRef : ItemReference;
- ; theType : FlavorType;
- ; dataPtr : UNIV Ptr;
- ; dataSize : Size;
- ; theFlags : FlavorFlags) : OSErr;
- ;
-
- MACRO
- _AddDragItemFlavor
- moveq #$07,d0
- _DragDispatch
- ENDM
-
-
- ;
- ; FUNCTION AddHFSFlavor (theDragRef : DragReference;
- ; theItemRef : ItemReference;
- ; fileSpec : FSSpec;
- ; theFlags : FlavorFlags) : OSErr;
- ;
-
- MACRO
- _AddHFSFlavor
- moveq #$08,d0
- _DragDispatch
- ENDM
-
-
- ;
- ; FUNCTION SetDragItemFlavorData (theDragRef : DragReference;
- ; theItemRef : ItemReference;
- ; theType : FlavorType;
- ; dataPtr : UNIV Ptr;
- ; dataSize : Size;
- ; dataOffset : LONGINT) : OSErr;
- ;
-
- MACRO
- _SetDragItemFlavorData
- moveq #$09,d0
- _DragDispatch
- ENDM
-
-
-
- ; Providing Drag Callback Procedures
-
- ;
- ; FUNCTION SetDragSendProc (theDragRef : DragReference;
- ; sendProc : DragSendDataProc;
- ; dragSendRefCon : UNIV Ptr) : OSErr;
- ;
-
- MACRO
- _SetDragSendProc
- moveq #$0A,d0
- _DragDispatch
- ENDM
-
-
- ;
- ; FUNCTION SetDragInputProc (theDragRef : DragReference;
- ; inputProc : DragInputProc;
- ; dragInputRefCon : UNIV Ptr) : OSErr;
- ;
-
- MACRO
- _SetDragInputProc
- moveq #$0B,d0
- _DragDispatch
- ENDM
-
-
- ;
- ; FUNCTION SetDragDrawingProc (theDragRef : DragReference;
- ; drawingProc : DragDrawingProc;
- ; dragDrawingRefCon : UNIV Ptr) : OSErr;
- ;
-
- MACRO
- _SetDragDrawingProc
- moveq #$0C,d0
- _DragDispatch
- ENDM
-
-
-
- ; Performing a Drag
-
- ;
- ; FUNCTION TrackDrag (theDragRef : DragReference;
- ; theEvent : EventRecord;
- ; theRegion : RgnHandle) : OSErr;
- ;
-
- MACRO
- _TrackDrag
- moveq #$0D,d0
- _DragDispatch
- ENDM
-
-
-
- ; Getting Drag Item Information
-
- ;
- ; FUNCTION CountDragItems (theDragRef : DragReference;
- ; VAR numItems : INTEGER) : OSErr;
- ;
-
- MACRO
- _CountDragItems
- moveq #$0E,d0
- _DragDispatch
- ENDM
-
-
- ;
- ; FUNCTION GetDragItemReferenceNumber
- ; (theDragRef : DragReference;
- ; index : INTEGER;
- ; VAR theItemRef : ItemReference) : OSErr;
- ;
-
- MACRO
- _GetDragItemReferenceNumber
- moveq #$0F,d0
- _DragDispatch
- ENDM
-
-
- ;
- ; FUNCTION CountDragItemFlavors (theDragRef : DragReference;
- ; theItemRef : ItemReference;
- ; VAR numFlavors : INTEGER) : OSErr;
- ;
-
- MACRO
- _CountDragItemFlavors
- moveq #$10,d0
- _DragDispatch
- ENDM
-
-
- ;
- ; FUNCTION GetFlavorType (theDragRef : DragReference;
- ; theItemRef : ItemReference;
- ; index : INTEGER;
- ; VAR theType : FlavorType) : OSErr;
- ;
-
- MACRO
- _GetFlavorType
- moveq #$11,d0
- _DragDispatch
- ENDM
-
-
- ;
- ; FUNCTION GetFlavorFlags (theDragRef : DragReference;
- ; theItemRef : ItemReference;
- ; theType : FlavorType;
- ; VAR theFlags : FlavorFlags) : OSErr;
- ;
-
- MACRO
- _GetFlavorFlags
- moveq #$12,d0
- _DragDispatch
- ENDM
-
-
- ;
- ; FUNCTION GetFlavorDataSize (theDragRef : DragReference;
- ; theItemRef : ItemReference;
- ; theType : FlavorType;
- ; VAR dataSize : Size) : OSErr;
- ;
-
- MACRO
- _GetFlavorDataSize
- moveq #$13,d0
- _DragDispatch
- ENDM
-
-
- ;
- ; FUNCTION GetFlavorData (theDragRef : DragReference;
- ; theItemRef : ItemReference;
- ; theType : FlavorType;
- ; dataPtr : UNIV Ptr;
- ; VAR dataSize : Size;
- ; dataOffset : LONGINT) : OSErr;
- ;
-
- MACRO
- _GetFlavorData
- moveq #$14,d0
- _DragDispatch
- ENDM
-
-
- ;
- ; FUNCTION GetDragItemBounds (theDragRef : DragReference;
- ; theItemRef : ItemReference;
- ; VAR itemBounds : Rect) : OSErr;
- ;
-
- MACRO
- _GetDragItemBounds
- moveq #$15,d0
- _DragDispatch
- ENDM
-
-
- ;
- ; FUNCTION SetDragItemBounds (theDragRef : DragReference;
- ; theItemRef : ItemReference;
- ; itemBounds : Rect) : OSErr;
- ;
-
- MACRO
- _SetDragItemBounds
- moveq #$16,d0
- _DragDispatch
- ENDM
-
- ;
- ; FUNCTION GetDropLocation (theDragRef : DragReference;
- ; VAR dropLocation : AEDesc) : OSErr;
- ;
-
- MACRO
- _GetDropLocation
- moveq #$17,d0
- _DragDispatch
- ENDM
-
-
- ;
- ; FUNCTION SetDropLocation (theDragRef : DragReference;
- ; dropLocation : AEDesc) : OSErr;
- ;
-
- MACRO
- _SetDropLocation
- moveq #$18,d0
- _DragDispatch
- ENDM
-
-
-
- ; Getting Information About a Drag
-
- ;
- ; FUNCTION GetDragAttributes (theDragRef : DragReference;
- ; VAR flags : DragAttributes) : OSErr;
- ;
-
- MACRO
- _GetDragAttributes
- moveq #$19,d0
- _DragDispatch
- ENDM
-
-
- ;
- ; FUNCTION GetDragMouse (theDragRef : DragReference;
- ; VAR mouse : Point;
- ; VAR pinnedMouse : Point) : OSErr;
- ;
-
- MACRO
- _GetDragMouse
- moveq #$1A,d0
- _DragDispatch
- ENDM
-
-
- ;
- ; FUNCTION SetDragMouse (theDragRef : DragReference;
- ; pinnedMouse : Point) : OSErr;
- ;
-
- MACRO
- _SetDragMouse
- moveq #$1B,d0
- _DragDispatch
- ENDM
-
-
- ;
- ; FUNCTION GetDragOrigin (theDragRef : DragReference;
- ; VAR initialMouse : Point) : OSErr;
- ;
-
- MACRO
- _GetDragOrigin
- moveq #$1C,d0
- _DragDispatch
- ENDM
-
-
- ;
- ; FUNCTION GetDragModifiers (theDragRef : DragReference;
- ; VAR modifiers : INTEGER;
- ; VAR mouseDownModifiers : INTEGER;
- ; VAR mouseUpModifiers : INTEGER) : OSErr;
- ;
-
- MACRO
- _GetDragModifiers
- moveq #$1D,d0
- _DragDispatch
- ENDM
-
-
-
- ; Drag Highlighting
-
- ;
- ; FUNCTION ShowDragHilite (theDragRef : DragReference;
- ; hiliteFrame : RgnHandle;
- ; inside : Boolean) : OSErr;
- ;
-
- MACRO
- _ShowDragHilite
- moveq #$1E,d0
- _DragDispatch
- ENDM
-
-
- ;
- ; FUNCTION HideDragHilite (theDragRef : DragReference) : OSErr;
- ;
-
- MACRO
- _HideDragHilite
- moveq #$1F,d0
- _DragDispatch
- ENDM
-
-
- ;
- ; FUNCTION DragPreScroll (theDragRef : DragReference;
- ; dH : INTEGER;
- ; dV : INTEGER) : OSErr;
- ;
-
- MACRO
- _DragPreScroll
- moveq #$20,d0
- _DragDispatch
- ENDM
-
-
- ;
- ; FUNCTION DragPostScroll (theDragRef : DragReference) : OSErr;
- ;
-
- MACRO
- _DragPostScroll
- moveq #$21,d0
- _DragDispatch
- ENDM
-
-
- ;
- ; FUNCTION UpdateDragHilite (theDragRef : DragReference;
- ; updateRgn : RgnHandle) : OSErr;
- ;
-
- MACRO
- _UpdateDragHilite
- moveq #$22,d0
- _DragDispatch
- ENDM
-
-
-
- ; Drag Manager Utilities
-
- ;
- ; FUNCTION WaitMouseMoved (initialMouse : Point) : BOOLEAN;
- ;
-
- MACRO
- _WaitMouseMoved
- moveq #$23,d0
- _DragDispatch
- ENDM
-
-
- ;
- ; FUNCTION ZoomRects (fromRect : Rect;
- ; toRect : Rect;
- ; zoomSteps : INTEGER;
- ; acceleration : ZoomAcceleration) : OSErr;
- ;
-
- MACRO
- _ZoomRects
- moveq #$24,d0
- _DragDispatch
- ENDM
-
-
- ;
- ; FUNCTION ZoomRegion (region : RgnHandle;
- ; zoomDistance : Point;
- ; zoomSteps : INTEGER;
- ; acceleration : ZoomAcceleration) : OSErr;
- ;
-
- MACRO
- _ZoomRegion
- moveq #$25,d0
- _DragDispatch
- ENDM
-
-
- ;
- ; Will move to TextEdit.h
- ;
- ; FUNCTION TEGetHiliteRgn (region : RgnHandle;
- ; hTE : TEHandle) : OSErr;
- ;
-
- MACRO
- _TEGetHiliteRgn
- move.w #$000F,-(sp)
- _TEDispatch
- ENDM
-
-
-
- ENDIF ; __INCLUDINGDRAG__
-
-